<template>
  <div>
    <div class="container radiusBottom">
      <div class="images">
        <div class="img">
          <img :src="styleUrls[dataJson.type][dataJson.stylesType]" />
        </div>
        <div class="buttonSetStyle" @click="alertTag">修改样式</div>
      </div>
    </div>

    <div>
      <div class="container">
        <div class="title">图片 1</div>
        <div class="line">
          <div class="left ">选择图片</div>
          <div class="imgContent ">
            <img
              v-if="dataJson.imgUrls[0].src"
              :src="dataJson.imgUrls[0].src"
            />
            <img v-else src="https://oss.ztwlxx.cn/default999.png" />
          </div>
          <div>
            <el-button class="btn" @click="showdialog(0)">上传图片</el-button>
          </div>
        </div>
        <div class="line">
          <div class="left">图片链接</div>
          <el-tooltip
            class="item"
            effect="dark"
            :content="dataJson.imgUrls[0].jump_name"
            placement="bottom"
          >
            <el-button @click="chooseLink(0)">
              {{ dataJson.imgUrls[0].jump_name || "选择链接" }}</el-button
            >
          </el-tooltip>
        </div>
        <div class="line">
          <div class="left">填写标题</div>
          <el-input
            v-model="dataJson.imgUrls[0].title"
            type="text"
            style="width:60%;"
            placeholder="请输入内容"
            maxlength="10"
            show-word-limit
          >
          </el-input>
        </div>
        <div class="line">
          <div class="left">填写内容</div>
          <el-input
            v-model="dataJson.imgUrls[0].substance"
            type="textarea"
            style="width:80%;"
            :autosize="{ minRows: 6, maxRows: 10 }"
            placeholder="请输入内容"
            maxlength="20"
            show-word-limit
          >
          </el-input>
        </div>
      </div>
      <div v-if="dataJson.stylesType == 3" class="container">
        <div class="title">图片 2</div>
        <div class="line">
          <div class="left ">选择图片</div>
          <div class="imgContent ">
            <img
              v-if="dataJson.imgUrls[1].src"
              :src="dataJson.imgUrls[1].src"
            />
            <img v-else src="https://oss.ztwlxx.cn/default999.png" />
          </div>
          <div>
            <el-button class="btn" @click="showdialog(1)">上传图片</el-button>
          </div>
        </div>
        <div class="line">
          <div class="left">图片链接</div>
          <el-tooltip
            class="item"
            effect="dark"
            :content="dataJson.imgUrls[1].jump_name"
            placement="bottom"
          >
            <el-button @click="chooseLink(1)">
              {{ dataJson.imgUrls[1].jump_name || "选择链接" }}</el-button
            >
          </el-tooltip>
        </div>
        <div class="line">
          <div class="left">填写标题</div>
          <el-input
            v-model="dataJson.imgUrls[1].title"
            type="text"
            style="width:60%;"
            placeholder="请输入内容"
            maxlength="10"
            show-word-limit
          >
          </el-input>
        </div>
        <div class="line">
          <div class="left">填写内容</div>
          <el-input
            v-model="dataJson.imgUrls[1].substance"
            type="textarea"
            style="width:80%;"
            :autosize="{ minRows: 6, maxRows: 10 }"
            placeholder="请输入内容"
            maxlength="20"
            show-word-limit
          >
          </el-input>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { styleUrls } from "../../data";
export default {
  props: {
    dataJson: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      styleUrls
    };
  },
  methods: {
    alertTag() {
      this.$emit("alertTag", true, this.dataJson.stylesType, 28);
    },
    chooseLink(index) {
      this.$emit("chooseLink", index);
    },
    showdialog(index) {
      this.$emit("showdialog", index);
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/scss/decorate.scss";
</style>
